/**
 * Created with IntelliJ IDEA.
 * User: amberhoule
 * Date: 13-12-23
 * Time: 11:50 AM
 * To change this template use File | Settings | File Templates.
 */
public class DiamondExercises {

    public static void isoscelesTriangle(int n){
        String center = "*";
        String left = " ";
        String right = " ";
        char[] leftArray = new char[n];
        char[] rightArray = new char[n];

        int i = 0;

        while(i < n ) {
            leftArray[i] = ' ';
            rightArray[i] = ' ';
            i++;
        }

        for(int j = 0; j < n; j++){
            left = String.valueOf(leftArray);
            right = String.valueOf(rightArray);
            System.out.println( left + center + right );
            leftArray[(n-1)-j] = '*';
            rightArray[j] = '*';
        }

    }

    public static void diamond(int n){
        String center = "*";
        String left = " ";
        String right = " ";
        char[] leftArray = new char[n];
        char[] rightArray = new char[n];

        int i = 0;

        while(i < n ) {
            leftArray[i] = ' ';
            rightArray[i] = ' ';
            i++;
        }

        for(int j = 0; j < n; j++){
            left = String.valueOf(leftArray);
            right = String.valueOf(rightArray);
            System.out.println( left + center + right );
            leftArray[(n-1)-j] = '*';
            rightArray[j] = '*';
        }

        for(int k = n; k > 0; k--){
            leftArray[n - k] = ' ';
            rightArray[k - 1] = ' ';
            left = String.valueOf(leftArray);
            right = String.valueOf(rightArray);
            if( k != n ){
                System.out.println( left + center + right );
            }
        }

    }

    public static void diamondWithName(int n){
        String center = "*";
        String left = " ";
        String right = " ";
        char[] leftArray = new char[n];
        char[] rightArray = new char[n];

        int i = 0;

        while(i < n ) {
            leftArray[i] = ' ';
            rightArray[i] = ' ';
            i++;
        }

        for(int j = 0; j < n - 1; j++){
            left = String.valueOf(leftArray);
            right = String.valueOf(rightArray);
            System.out.println( left + center + right );
            leftArray[(n-1)-j] = '*';
            rightArray[j] = '*';
        }

        System.out.println("Amber");

        for(int k = n - 1; k > 0; k--){
            leftArray[n - k] = ' ';
            rightArray[k - 1] = ' ';
            left = String.valueOf(leftArray);
            right = String.valueOf(rightArray);
            System.out.println( left + center + right );
        }
    }
}
